<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>处理管理员登录页面</title>
</head>
<body>
	<?php 
    //接收表单数据；连接数据库，查询admins表进行信息的比对，能比对成功，就跳转到welcome页，比对失败
    //返回登录页重新登录
   // require_once("../system/loginCheck.php");
  session_start();
if(!isset($_SESSION["adminname"]))
  header("location:index.php?msg2=您没有权限!");
      require_once("../system/dbConn.php");
      

   $adminname=$_POST["adminname"];
   $password=$_POST["password"];
    
   $sql="select * from admins where adminname='$adminname'and password='$password'";
   // echo $sql."<br>";
   $result=mysqli_query($link,$sql);
//结果集
  $num=mysqli_num_rows($result);
  if ($num>0){
    //将管理员的名字记录到session中
    $row=mysqli_fetch_assoc($result);
    session_start();//启动会话
    $_SESSION["adminname"]=$adminname;
    $_SESSION["adminid"]=$row["adminid"];
  	//查到了
  	// echo "login success";
  	header("location:welcome.php");
  }else{
  	header("location:index.php?err=1");
  
  }
    


	 ?>
</body>
</html>